package com.webapp.domain.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 * 咨询师
 */
@Entity
public class Counselor extends BaseEntity {

	private static final long serialVersionUID = 1L;
	
	private Long id;
	private String status;//状态
	private String level;
	private List<Session> sessions;
	private String password;//密码/验证码
	private String email; //邮箱   /暂时没用上
	private Date createDate;//创建时间
	private CounselorDetail counselorDetail;
	private String isLogin;///1标记用户在线，0标记离线，2标记发送离线短信通知
	private String headPortrait;//咨询师头像
	
	private Integral integral;
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	@OneToOne(mappedBy="counselor",cascade=CascadeType.ALL,fetch=FetchType.LAZY,targetEntity=CounselorDetail.class)
	public CounselorDetail getCounselorDetail() {
		return counselorDetail;
	}
	public void setCounselorDetail(CounselorDetail counselorDetail) {
		this.counselorDetail = counselorDetail;
	}
	public String getLevel() {
		return level;
	}
	public void setLevel(String level) {
		this.level = level;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	
	@OneToMany(mappedBy="counselor",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	public List<Session> getSessions() {
		return sessions;
	}
	public void setSessions(List<Session> sessions) {
		this.sessions = sessions;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public String getIsLogin() {
		return isLogin;
	}
	public void setIsLogin(String isLogin) {
		this.isLogin = isLogin;
	}
	public String getHeadPortrait() {
		return headPortrait;
	}
	public void setHeadPortrait(String headPortrait) {
		this.headPortrait = headPortrait==null?"hp.png":headPortrait;
	}
	

	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY,targetEntity=Integral.class)
	@JoinColumn(name="integral_id")
	public Integral getIntegral() {
		return integral;
	}
	public void setIntegral(Integral integral) {
		this.integral = integral;
	}
	
	
	
	

}
